package entity;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class Staff extends Account {

	private String name;

	@ManyToOne
	private Company company;

	@OneToMany(mappedBy = "staff", cascade = CascadeType.ALL)
	private Collection<EquipmentBorrow> equipmentBorrows = new ArrayList<EquipmentBorrow>();

	@OneToMany(mappedBy = "staff", cascade = CascadeType.ALL)
	private Collection<EquipmentReturn> equipmentReturns = new ArrayList<EquipmentReturn>();

	public Staff(Company company) {
		this.company = company;
		if (company != null)
			company.getStaffs().add(this);
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public Collection<EquipmentBorrow> getEquipmentBorrows() {
		return equipmentBorrows;
	}

	public void setEquipmentBorrows(Collection<EquipmentBorrow> equipmentBorrows) {
		this.equipmentBorrows = equipmentBorrows;
	}

	public Collection<EquipmentReturn> getEquipmentReturns() {
		return equipmentReturns;
	}

	public void setEquipmentReturns(Collection<EquipmentReturn> equipmentReturns) {
		this.equipmentReturns = equipmentReturns;
	}

}